package com.cloud.cmt.cmtcontrol.controller;

import com.cloud.cmt.cmtcontrol.clusterdatasource.DynamicThreadLocal;
import com.cloud.cmt.cmtcontrol.entity.UserInfo;
import com.cloud.cmt.cmtcontrol.service.impl.UserServiceImpl;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * 
 * @ClassName: UserInfoController 
 * @Description: TODO
 * @author leepon1990
 * @date 2016年4月6日 下午12:55:33 
 *
 */
@RestController
@RequestMapping("/users")
public class UserInfoController {

    @Autowired
    private UserServiceImpl userService;


    @ApiOperation(value = "根据租户id获取信息")
    @ApiResponses({@ApiResponse(code = 200, message = "success")})
    @RequestMapping(value = "/{tenId}/{id}" ,method = RequestMethod.GET)
    public UserInfo view(@PathVariable String tenId, @PathVariable Integer id) {
        DynamicThreadLocal.setTenlentId(tenId);
        UserInfo userInfo = userService.getUserInfoById(id);
        return userInfo;
    }
}
